
#ifndef LIGHT_H
#define LIGHT_H

#include"ray.h"

#include"algfloat.h"

class Light
{
  float wpos[4];
  float vpos[4];
  public:
  Light (float x, float y, float z)
  {
    wpos[0]=x;   vpos[0]=x; 
    wpos[1]=y;   vpos[1]=y; 
    wpos[2]=z;   vpos[2]=z; 
    wpos[3]=1.0; vpos[3]=1.0; 
  };
  void SetupRay(Ray *r)
  {
    int level = SHADOW_RAY;
    float * p = r->GetP(level);
    float * d = r->GetD(level);
    AFSub(vpos, p, d);
    r->tmax = AFNorm(d);
    d[3]=0.0;
    AFUnit(d);
  };
  void SetViewPos (float * mat)
  {
    AFMatXVec(mat,wpos,vpos);
  };
};

#endif

